import { createApp } from 'vue';
import App from './App.vue';
import store from './store';
import router from '@/router';

import { Popup, Cell, CellGroup, Collapse, CollapseItem, ConfigProvider } from 'vant';
import 'vant/lib/index.css';

import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
// import locale from 'element-plus/lib/locale/lang/zh-cn' // 中文语言
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import 'dayjs/locale/zh-cn';

import './permission'; // permission control
import directive from './directive'; // directive

import naive from 'naive-ui';
// import "@/mock/index.js"
import { setupProdMockServer } from '@/mock/index';
setupProdMockServer();
// 通用字体
import 'vfonts/Lato.css';
// 等宽字体
import 'vfonts/FiraCode.css';
import '@/assets/font/font.css';
import '@/assets/styles/index.scss';

import 'virtual:svg-icons-register';

import '@/assets/styles/vs2015.css';
import 'highlight.js/lib/common';
import hljsVuePlugin from '@highlightjs/vue-plugin';
import javascript from 'highlight.js/lib/languages/javascript';
import hljs from 'highlight.js/lib/core';
import css from 'highlight.js/lib/languages/css';
import bash from 'highlight.js/lib/languages/bash';
import xml from 'highlight.js/lib/languages/xml';
import typescript from 'highlight.js/lib/languages/typescript';
hljs.registerLanguage('javascript', javascript);
hljs.registerLanguage('css', css);
hljs.registerLanguage('bash', bash);
hljs.registerLanguage('xml', xml);
hljs.registerLanguage('typescript', typescript);

import SvgIcon from '@/components/SvgIcon/index.vue';
import PreCode from '@/components/PreCode/index.vue';

// 创建vue实例
const app = createApp(App);

// 挂载pinia
app.use(store);
app.use(router);
app.use(naive);
app.use(hljsVuePlugin);

app.use(Popup);
app.use(Cell);
app.use(CellGroup);
app.use(Collapse);
app.use(CollapseItem);
app.use(ConfigProvider);

app.component('SvgIcon', SvgIcon);
app.component('PreCode', PreCode);

directive(app);

// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
  locale: zhCn,
});
// 挂载实例
app.mount('#app');
